Quản lý website giới thiệu và bán điện thoại di động ASP.net
19.271 lượt xem;
- themsp.aspx.cs
- project /
1 using System;
2 using System.Data;
3 using System.Configuration;
4 using System.Collections;
5 using System.Web;
6 using System.Web.Security;
7 using System.Web.UI;
8 using System.Web.UI.WebControls;
9 using System.Web.UI.WebControls.WebParts;
10 using System.Web.UI.HtmlControls;
11 using System.Data.OleDb;
12 public partial class Default3 : System.Web.UI.Page
13 {
14 OleDbConnection con;
15 OleDbCommand cm;
16 protected void Page_Load(object sender, EventArgs e)
17 {
18
19 }
20 protected void btndangky_Click(object sender, EventArgs e)
21 {
22
23 if (txtmasp.Text != "")
24 {
25 if (Txttensp.Text != "")
26 {
27 if (txtgia.Text != "")
28 {
29
30 //Download source code tại Sharecode.vn
31 con = new OleDbConnection();
32 con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MyDBConnectionString"].ToString();
33 con.Open();
34 cm = new OleDbCommand("insert into tblsanpham values ('" + txtmasp.Text + "','" + DropDownList1.Text + "','" + Txttensp.Text + "','" + txtgia.Text + "','" + txtsl.Text + "','" + txtdd.Text + "','" + txtbh.Text + "','" + txtkm.Text + "','" + txtkd.Text + "','" + Txtpc.Text + "','" + Txtanh.Text + "','" + Txtghichu.Text + "')", con);
35 cm.ExecuteNonQuery();
36 cm.Dispose();
37 con.Close();
38 Lbltb.Text = "bạn đã nhập thành công";
39 }
40 else Lbltb.Text = "bạn chưa nhập giá của sản phẩm";
41 }
42 else Lbltb.Text = "Bạn chưa nhập tên của sản phẩm";
43 }
44 else Lbltb.Text = "Bạn phải nhập mã hàng";
45 }
46 }
2 using System.Data;
3 using System.Configuration;
4 using System.Collections;
5 using System.Web;
6 using System.Web.Security;
7 using System.Web.UI;
8 using System.Web.UI.WebControls;
9 using System.Web.UI.WebControls.WebParts;
10 using System.Web.UI.HtmlControls;
11 using System.Data.OleDb;
12 public partial class Default3 : System.Web.UI.Page
13 {
14 OleDbConnection con;
15 OleDbCommand cm;
16 protected void Page_Load(object sender, EventArgs e)
17 {
18
19 }
20 protected void btndangky_Click(object sender, EventArgs e)
21 {
22
23 if (txtmasp.Text != "")
24 {
25 if (Txttensp.Text != "")
26 {
27 if (txtgia.Text != "")
28 {
29
30 //Download source code tại Sharecode.vn
31 con = new OleDbConnection();
32 con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MyDBConnectionString"].ToString();
33 con.Open();
34 cm = new OleDbCommand("insert into tblsanpham values ('" + txtmasp.Text + "','" + DropDownList1.Text + "','" + Txttensp.Text + "','" + txtgia.Text + "','" + txtsl.Text + "','" + txtdd.Text + "','" + txtbh.Text + "','" + txtkm.Text + "','" + txtkd.Text + "','" + Txtpc.Text + "','" + Txtanh.Text + "','" + Txtghichu.Text + "')", con);
35 cm.ExecuteNonQuery();
36 cm.Dispose();
37 con.Close();
38 Lbltb.Text = "bạn đã nhập thành công";
39 }
40 else Lbltb.Text = "bạn chưa nhập giá của sản phẩm";
41 }
42 else Lbltb.Text = "Bạn chưa nhập tên của sản phẩm";
43 }
44 else Lbltb.Text = "Bạn phải nhập mã hàng";
45 }
46 }